function register(){

	var f_name = $('#f_name').val();
	var l_name = $('#l_name').val();
	var pwd = $('#password').val();
	var pwd2 = $('#password2').val();
	var email = $('#email').val();
	var phone = $('#phone').val();
	var gender  = $("input[name='gender']:checked").val();
	if(checkparams(f_name,1)==false||checkparams(l_name,1)==false||checkparams(pwd,6)==false||checkparams(email,6)==false||checkparams(phone,11)==false){
		alert('Information error, please improve');
		return ;
	}
	if(gender==''||gender==null){
		alert('Please choose sex');
		return ;
	}
	if(pwd!=pwd2){
		alert('2 cipher inconsistencies');
		return ;
	}
	$.ajax({
		url:'/index/doregister.html',
		type:'post',
		dataType:'json',
		data:{f_name:f_name,l_name:l_name,pwd:pwd,email:email,phone:phone,gender:gender},
		success:function(res){
			alert(res.msg);
			if(res.code==0){
				location.href='/index/index.html'
			}
		}
	
		
	})
	
}

function checkparams(value,len){
	if(value.length<len){
		return false;
	}
	return true;
	
}

function login(){
	var phone = $('#phone').val();
	var pwd = $('#pwd').val();
	if(checkparams(phone,11)==false||checkparams(pwd,6)==false){
		alert('Information error, please improve');
		return ;
	}
	$.ajax({
		url:'/index/dologin.html',
		type:'post',
		dataType:'json',
		data:{phone:phone,pwd:pwd},
		success:function(res){
			alert(res.msg);
			if(res.code==0){
				location.href='/index/member.html'
			}
		}
	
		
	})
}